mucho cuidado con esta pestaña, es mortal
---
title: "Alumnado UCM"
author: "Óscar Cabestrero Aranda"
date: "`r Sys.Date()`"
output:
flexdashboard::flex_dashboard:
theme: simplex
source_code: embed
logo: 2.png
favicon: 2.png
social: [ "youtube", "telegram", "menu" ]
navbar:
- { title: "Datasets", href: "https://www.ucm.es/la-universidad-en-cifras", align: left }
---
```{r setup, include=FALSE}
library(flexdashboard)
library(readr)
library(dplyr)
library(ggplot2)
library(DT)
library(plotly)
df <- read_delim("datos_tratados.csv", delim = ";")
df$CURSO <- factor(df$CURSO)
df$CENTRO <- factor(df$CENTRO)
grouped_data <- df %>%
group_by(CURSO) %>%
summarise(across(where(is.numeric), sum))
df_2 <- filter(df, CENTRO == "GEOLOGICAS")
df_3 <- filter(df, CENTRO == "GEOLOGICAS" | CENTRO == "ESTUDIOS_ESTADISTICOS")
df_3$CURSO <- factor(df_3$CURSO)
df_3$CENTRO <- factor(df_3$CENTRO)
df_4_M <- select(grouped_data,CURSO,TOTAL_MUJERES)
df_4_H <- select(grouped_data,CURSO,TOTAL_HOMBRES)
colnames(df_4_M)[2] <-"TOTAL"
colnames(df_4_H)[2] <-"TOTAL"
df_4_M$GÉNERO <- rep('Mujer', times = nrow(df_4_M))
df_4_H$GÉNERO <- rep('Hombre', times = nrow(df_4_H))
df_5 <- bind_rows(df_4_M,df_4_H)
```
Column {data-width=1920}
-----------------------------------------------------------------------
# Página 1 {data-icon=fa-question}
## Columna 1
### Componente ggplot2
```{r fig.width=10, fig.height=5}
g1 <- ggplot(df_2) +
geom_col(aes(x = CURSO, y = TOTAL), col = "orange", fill = "aquamarine") +
labs(title = "CENTRO: GEOLOGICAS ",
subtitle = "U.C.M.",
x = "Curso",
y = "Total de alumno/as.",
caption = "Datos tomados del Centro de Inteligencia Institucional, U.C.M."
) +
theme_linedraw()+
theme(axis.text.x = element_text(angle = 25, vjust = 1, hjust = 1, size = 8))
g2 <- ggplotly(g1)
g2
```
## Columna 2
### Componente de tabla
```{r fig.width=10, fig.height=5}
tabla_interactiva <- datatable(df, options = list( pageLength = 50))
tabla_interactiva
```
## Columna 3
## Columna 4
# Página 2 {data-icon=fa-exclamation}
## Columna
### Componente de ggplot2
```{r fig.width=10, fig.height=5}
g3 <- ggplot(df_3) +
geom_col(aes(x = CURSO, y = TOTAL, fill = CENTRO), position = "dodge") +
labs(subtitle = "Gráfico con fill = CENTRO y position = dodge",
x = "Curso",
y = "Total de alumno/as."
) +
theme(axis.text.x = element_text(angle = 30, vjust = 1, hjust = 1, size = 8),
# arriba(top), izquierda (left), derecha (right), abajo (bottom)
legend.position = "right"
)
g4 <- ggplotly(g3)
g4
```
# Página 3 {data-icon=fa-skull-crossbones}
## Columna 1
### Cuadro de texto sin título {data-height=100 .no-title}
**mucho cuidado con esta pestaña, es mortal**
# Página 4 {data-icon=fa-circle-radiation}
### Cuadro de texto con comentarios {data-height=300}